package cn.exrick.xboot.modules.base.dao.sqlprovider;

import cn.exrick.xboot.modules.base.entity.UserHierarchy;
import lombok.extern.slf4j.Slf4j;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: njp
 * @Date: 2020/11/06/10:09
 * @Description:
 */
@Slf4j
public class UserHierarchySqlProvider {

    public String getUserHierarchys(UserHierarchy userHierarchy){
        StringBuffer sql=new StringBuffer();
        sql.append("SELECT uh.id,uh.hierarchy_id,uh.user_id,d.title as title FROM t_user_hierarchy uh ");
        sql.append("left JOIN t_department d on uh.hierarchy_id=d.id");
        sql.append(" where ");
        sql.append(" uh.user_id='"+userHierarchy.getUserId()+"'");
        /*sql.append(" and ");
        sql.append(" uh.hierarchy_id='"+userHierarchy.getHierarchyId()+"'");*/
        sql.append(" and ");
        sql.append(" uh.type='"+userHierarchy.getType()+"'");
        log.info("getUserHierarchys方法对应sql:"+sql.toString());
        return sql.toString();
    }
}
